package com.seecoder.BlueWhale.repository;

import com.seecoder.BlueWhale.po.Order;
import com.seecoder.BlueWhale.po.Store;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface StoreRepository extends JpaRepository<Store, Integer> {
    Store findByName(String name);

    //如果参数是Integer类型，则返回值要套上<Optional>，但这里没有必要。
    Store findById(int id);

    @Query("SELECT o FROM Store o WHERE o.id = (SELECT MAX(o2.id) FROM Store o2)")
    Store findWithMaxId();
}